#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time       :   14:09
# Author     : Y4
# Site       : 
# File       : get_admin_user.py
from App.models.backend import AdminUser


def get_admin_user(user_ident):
    if not user_ident:
        return None

    # 根据uuid
    user = AdminUser.query.filter(AdminUser.uuid == user_ident).first()
    if user:
        return user

    # 根据用户名
    user = AdminUser.query.filter(AdminUser.username == user_ident).first()
    if user:
        return user

    return None